package com.ruoyi.project.system.customer.service

import java.util

import com.ruoyi.common.utils.DateUtils
import com.ruoyi.common.utils.text.Convert
import com.ruoyi.project.system.customer.domain.Customer
import com.ruoyi.project.system.customer.mapper.CustomerMapper
import org.apache.poi.ss.formula.functions.T
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service


/**
 * 客户Service业务层处理
 *
 * @author daixiang
 * @date 2022-04-15
 */

@Service
class CustomerServiceImpl @Autowired()(val customerMapper: CustomerMapper) extends ICustomerService {

  /**
   * 查询客户
   *
   * @param customerNo 客户主键
   * @return 客户
   */
  override def selectCustomerById(customerNo: String): Customer = customerMapper.selectCustomerById(customerNo)
  /**
   * 查询客户
   *
   * @param customerNo 客户主键
   * @return 客户
   */
  override def selectCustomerByCustomerNo(customerNo: String): Customer = customerMapper.selectCustomerByCustomerNo(customerNo)

  /**
   * 查询客户列表
   *
   * @param customer 客户
   * @return 客户
   */
  override def selectCustomerList(customer: Customer): util.List[Customer] = customerMapper.selectCustomerList(customer)

  /**
   * 新增客户
   *
   * @param customer 客户
   * @return 结果
   */
  override def insertCustomer(customer: Customer): Int = {
    customerMapper.insertCustomer(customer)
  }

  /**
   * 修改客户
   *
   * @param customer 客户
   * @return 结果
   */
  override def updateCustomer(customer: Customer): Int = {
    customerMapper.updateCustomer(customer)
  }

  /**
   * 批量删除客户
   *
   * @param customerNos 需要删除的客户主键
   * @return 结果
   */
  override def deleteCustomerByCustomerNos(customerNos: String): Int = customerMapper.deleteCustomerByCustomerNos(Convert.toStrArray(customerNos))

  /**
   * 删除客户信息
   *
   * @param customerNo 客户主键
   * @return 结果
   */
  override def deleteCustomerByCustomerNo(customerNo: String): Int = customerMapper.deleteCustomerByCustomerNo(customerNo)

  override def countAll(requset: Customer): Integer = customerMapper.countAll(requset)

  override def selectAll(request: Customer): util.ArrayList[Customer] = customerMapper.selectAll(request)
}

